home *** CD-ROM | disk | FTP | other *** search
-
-
- 56 SPRITES
- by
- Jonathan Rodda
-
- COMMODORE POWER/PLAY MAGAZINE
- April/May, 1986
- p.97
-
- Computer programmers are, by
-
- nature, a bunch of showoffs. In
-
- fact, sometimes the only way to get
-
- them going is to tell them that
-
- something is impossible. Then watch
-
- out-- they will eat their disk
-
- libraries before they throw in the
-
- towel.
-
-
- Take sprites, for example.
-
- Everyone knows that you cannot have
-
- more than eight sprites on the screen
-
- at a time. End of argument. Even
-
- programmers cannot change that law.
-
-
- But with almost every rule, there
-
- is an exception. 56 Sprites is an
-
- example of just such an exception.
-
-
- One of the most powerful features
-
- of the Commodore 64 is the raster
-
- interrupt. By using raster
-
- interrupts, for example, you can
-
- display several background colors on
-
- the screen, or display graphics and
-
- text on the same screen.
-
-
- Or, as 56 SPRITES demonstrates, you
-
- can have more than the usual eight
-
- sprites on the screen.
-
-
- But quick-- what exactly is a
-
- "raster interrupt"? Forget the
-
- interrupt-- what is a "raster"?
-
-
- Everything centers around how
-
- pictures are displayed on the the
-
- monitor. The picture tube consists
-
- of an electron gun on one end and a
-
- screen on the other. The screen is
-
- filled with rows of phosphor dots
-
- that glow when they are struck by an
-
- electron. These dots are called
-
- "pixels"; a horizontal row of pixels
-
- is called a raster.
-
-
- When the picture signal is fed to
-
- the electron gun, it scans each
-
- raster from left to right, activating
-
- the pixels as determined by the
-
- signal. After one raster has been
-
- scanned, the beam drops to the next
-
- line.
-
-
- The picture is redrawn sixty times
-
- per second. This drawing process,
-
- however, can be stopped for a moment
-
- with a raster interrupt. During the
-
- time that the drawing process is
-
- halted, another operation can be
-
- performed. Then the drawing process
-
- continues where it left off.
-
-
- Because pixels continue to glow for
-
- a moment after being excited by an
-
- electron, images generated during
-
- the raster interrupt can appear to
-
- exist simultaneously on the screen
-
- when in fact you are seeing their
-
- afterimages.
-
-
- For example, the seven rows of
-
- eight sprites you will see when you
-
- run 56 SPRITES seem to occur all at
-
- once on the screen.
-
-
- Actually, there is only one row of
-
- sprites which is redrawn in a
-
- different part of the screen at every
-
- screen update (once every 60
-
- seconds). Because of the speed of
-
- the update and the tendency of pixels
-
- to hold an afterimage, there seem
-
- to be 56 sprites on the screen.
-
-
- To learn more about the ins and
-
- outs of raster interrupts, refer to
-
- Rodda's article in the Commodore
-
- magazine cited above.
-
- NOTE: Because of the nature of this
- program, it can not be run from the
- Loadstar environment. To run 56
- Sprites, exit Loadstar, type
- LOAD"56 SPRITES",8 <RETURN> and
- RUN <RETURN>.
-
- FILES REQUIRED:
-
- 56 SPRITES
-
- ----------<end of text>-------------
-
-